package com.luckberry.murder.mapper;

import com.luckberry.murder.entity.House;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface HouseMapper {

    @Select("select * from house")
    List<House> getHouses();

    @Select("select * from house where state = #{state}")
    List<House> getHousesByState(String state);

    @Select("select * from house where sid = #{sid}")
    List<House> getHousesByScript(int sid);

    @Select("select * from house where hid = #{hid}")
    House getHouse(int hid);

    @Insert("insert into house(sid, state) VALUES (#{sid}, #{state})")
    int addHouse(House house);

    @Delete("delete house from house where hid = #{hid}")
    int deleteHouse(int hid);

    @Update("update house set sid = #{sid}, state = #{state} where hid = #{hid}")
    int editHouse(House house);
}
